package com.bluesky.plum.domain.repository;

import java.util.List;

import com.bluesky.plum.domain.repository.impl.ListRepository;

/**
 * this is expect to wrap any collection to a Repository. such as
 * set,list,array,record set,...
 * 
 * @author HZ00260
 * 
 */
public class RepositoryWrapper {

	public static Repository wrap(Object obj) {
		if (obj instanceof Repository)
			return (Repository) obj;
		else if (obj instanceof List)
			return new ListRepository((List) obj);
		else
			throw new RuntimeException("unrecognized collection");

	}

}
